﻿<%@page import="java.util.*" %>
<%
  
  
  List userRole=(List)request.getAttribute("userrole");  
  
  String userId=request.getParameter("userId");  
%>   

	
<!DOCTYPE html>  
<html>  
<head>  
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">  
    <meta name="keywords" content="员工角色">  
    <meta name="description" content="员工角色">  
    <title>员工角色管理</title>  
    
    <%@ include file="/WEB-INF/inc/default.jsp"%>
    <jsp:include page="/WEB-INF/inc/dic.jsp"/>

</head>  
<body>  
    
    <div class="easyui-panel"  style="width:400px">
        <div style="padding:10px 0 10px 60px">
        <form id="fm" method="post">
        	  <input type="hidden" value="<%=userId%>" name="userId" > 
            <table>
            	<% for(int i=0;userRole!=null&&i<userRole.size();i++){
            	   Map urole=(Map)userRole.get(i);
            	   String hasrole=(String)urole.get("hasRole");
            	   String checked="";
            	   if ("1".equals(hasrole)) checked="checked='true'";
            	%>
                <tr>
                    
                    <td><input  type="checkbox" value="<%=urole.get("roleId")%>" <%=checked%> name="roleId"></input></td><td><%=(String)urole.get("name")%></td>
                    
                </tr>
              <% } %>  
            </table>
        </form>
        </div>
        <div id="dlg-buttons" style="text-align:center;padding:5px">  
          <a href="javascript:void(0)" id="btn-save" class="easyui-linkbutton" iconCls="icon-ok" onclick="save()">保存</a>  
          <a href="javascript:void(0)" id="btn-close" class="easyui-linkbutton" iconCls="icon-cancel" onclick="">关闭</a>  
        </div> 
    </div>  
    
    <script type="text/javascript">   
       var url='/auth/systemUser/userrolesave.do';
     function save(){          	   
        
        	  //if (!$('#fm').form('validate')) return; 
        
            $('#fm').form('submit',{  
                url: url,  
                onSubmit: function(){  
                    return $(this).form('validate');  
                },  
                success: function(result){  
                    var result = eval('('+result+')');  
                    
                    if (result.success == true){  
                    
                         alert(result.msg);
                        if (refresh) refresh();
                        if (closeWin) closeWin();
                    } else {  
                       alert(result.msg);
                    
                    }  
                }  
            });  
        }   
   
     
    </script>
     
     
     
</body>  
</html>